package com.xlh.dto.courseTest.experiment;

import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import java.math.BigDecimal;

/**
 * @author cfz
 */
@Data
@ApiModel(" 理论课章节统计导出ExcelDto ")
@Accessors(chain = true)
public class ExperimentChapterStatisticsExportDTO {

    @ApiModelProperty(" 学生Id ")
    private Long id;

    @ApiModelProperty("序号")
    private Integer index;

    @ApiModelProperty(" 学生姓名 ")
    private String name;

    @ApiModelProperty(" 学号 ")
    private String userNumber;

    @ApiModelProperty(" 学习时长 ")
    private String learnTime;

    @ApiModelProperty(" 视频时长 ")
    private String videoTime;

    @ApiModelProperty(" 实验分数 ")
    private Integer score;

    @ApiModelProperty(" 通过状态 ")
    private String passState;


    public void initProperty() {
        this.setLearnTime("0");
        this.setVideoTime("0");
        this.setScore(0);
    }

    /**
     * 将学习时间更改为小时
     */
    public void setTimeToHours() {

        if(ObjectUtil.isNull(videoTime)){
            videoTime = "0";
        }
        if(ObjectUtil.isNull(learnTime)){
            learnTime = "0";
        }
        videoTime = String.valueOf(NumberUtil.div(Double.valueOf(videoTime), Double.valueOf(3600d),2));
        learnTime = String.valueOf(NumberUtil.div(Double.valueOf(learnTime), Double.valueOf(3600d), 2));
    }


}
